Skip to content

Read jwt_token from the environment in upload_dars.sh - #96

Open
gyorgybalazsi wants to merge 2 commits into
mainfrom
fix/upload-dars-jwt-token
Open

gyorgybalazsi wants to merge 2 commits into
mainfrom
fix/upload-dars-jwt-token

Conversation

@gyorgybalazsi

@gyorgybalazsi gyorgybalazsi commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

What

cbtc-dars/upload_dars.sh now reads jwt_token from the environment. Line 13 changes from jwt_token="" to jwt_token="${jwt_token:-}".

The DAR README now gives one way to set the token: export jwt_token=....

Why

The script set jwt_token="" at the top, so it replaced a token that the user exported. The README and the DAR install guide on docs.bitsafe.finance both tell users to run export jwt_token=.... With that instruction, the upload went to the Admin API with no Authorization header. It could not succeed on a participant that requires a token.

The default is still an empty string. A user who exports no token gets the same behaviour as before: no header.

Who this affects

Canton requires a token on the Admin API only when the operator configures auth-services on it. Without that setting, the Admin API accepts requests with no token.

  • Participants with Admin API auth: the old script could never upload, because it always dropped the exported token. This PR fixes them.
  • Participants without Admin API auth: nothing changes. They need no token, and the script still sends no header when none is exported.

Our own configs in canton and dlc-attestor-stack set no auth-services on the Admin API. I do not know how customer participants are configured, so the README and the docs keep the token optional. See Configure API Authentication and Authorization with JWT.

How tested

I ran the script with a stub grpcurl that records its arguments, from a directory with one test DAR.

  • Old script, token exported: no Authorization header. This reproduces the bug.
  • New script, token exported: the header carries the token.
  • New script, no token exported: no header, as before.

I did not test against a real participant.

Notes

The DAR README also offered a second option: write the token into upload_dars.sh. The script is a tracked file, so that option puts a token one commit away from the repository. This PR removes it and keeps only export jwt_token=....

🤖 Generated with Claude Code

upload_dars.sh set jwt_token="" at the top, which replaced a token the
user exported. The README and the DAR install guide both tell users to
export jwt_token, so the upload went out without an Authorization
header. Default the variable to the exported value instead.

Tested with a stub grpcurl: an exported token now reaches the request,
no token still sends no header, and the old script fails the same check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gyorgybalazsi
gyorgybalazsi requested review from a team and sosaucily and a balanced review from Copilot October 9, 2026 12:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused change correctly fixes the documented authentication issue without altering unauthenticated behavior.

0 open findings

What changed in this PR

Updates the DAR upload script to preserve an optional JWT token supplied through the environment.

Changes:

  • Reads jwt_token from the environment with an empty fallback.
  • Documents the fix in the changelog.
File Description
CHANGELOG.md Records the JWT environment-variable fix.
cbtc-dars/​upload_dars.sh Preserves an exported JWT token for authenticated uploads.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

The DAR README offered two ways to set jwt_token: export it, or write
it into upload_dars.sh. The script is tracked, so the second option
puts a token one commit away from the repository. Now that the script
reads the exported value, keep only the export.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants